package com.xuerhua.yxt.controller.sys.repair;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.xuerhua.yxt.controller.BaseController;
import com.xuerhua.yxt.model.Grid;
import com.xuerhua.yxt.model.OnlineRepair;
import com.xuerhua.yxt.page.Page;
import com.xuerhua.yxt.service.IOnlineRepairService;
import com.xuerhua.yxt.vo.FailRepairQueryVO;

@RequestMapping("/sys/repair/query")
@Controller
public class SysRepairQueryController extends BaseController {
	
	@Autowired
	private IOnlineRepairService onlineRepairService;
	
	@RequestMapping(value={"","/"})
	public String Index() {
		return "sys/repair/query";
	}
	
	@RequestMapping("pageQuery")
	@ResponseBody Object pageQuery(FailRepairQueryVO vo){
		try {
			Page<OnlineRepair> page = new Page<>();
			page.setPageNo(vo.getPage());
			page.setPageSize(vo.getRows());
			page.setParams(vo);
			List<OnlineRepair> list = onlineRepairService.selectListByPage(page);
			Grid grid = new Grid();
			grid.setRows(list);
			grid.setTotal(page.getTotalRecord());
			return grid;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
}
